#include "event/loop.hpp"
#include "event/signal_event.hpp"

#include <chrono>
#include <iostream>
#include <thread>

using namespace std;
using namespace std::literals;
using namespace ibox;

int main() {
    auto loop = event::Loop();

    event::SignalEvent signal_timer{
        loop.ptr(), set<int>{SIGUSR1, SIGINT}, event::Event::Mode::Forever};
    int i = 0;
    signal_timer.set_callback([&](int signo) {
        std::cout << "signo: " << signo << '\n';
        i++;
    });
    signal_timer.enable();

    loop.submit([] { raise(SIGUSR1); });
    loop.stop(5s);

    cout << "loop running ...\n";
    loop.run();
}
